// hyb_yl/twosubpages/pages/yuzhen/yuzhen.js
var app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    isLoading: !0,
    searchvals:"",
    list:[],
    keyword:"",
    page:0,
    pagesize:10,
    chatwo:[
      { title: "体检解读", imgs:"https://6a69-jin5201-a4503e-1257013711.tcb.qcloud.la/cha4.jpg?sign=d19473581d0352ced01382431ee77d0e&t=1585151520",type:'3'},
      { title: "家庭常备药", imgs: "https://6a69-jin5201-a4503e-1257013711.tcb.qcloud.la/cha5.jpg?sign=7518761189e90e64b9673a62766cca06&t=1585151533" ,type:'4'},
      { title: "法定传染病", imgs: "https://6a69-jin5201-a4503e-1257013711.tcb.qcloud.la/cha6.jpg?sign=baf97cc04a10c877796236eb87b50641&t=1585151543" ,type:'5'},
    ],
  },
  handleTap(e){
      var type = e.currentTarget.dataset.type;
      if (e.currentTarget.dataset.detail == "查疾病"){
        wx.navigateTo({
          url: '/hyb_yl/twosubpages/pages/more/more',
        })
      }else{
      wx.navigateTo({
        url: '/hyb_yl/twosubpages/pages/itemdetail/itemdetail?type='+type,
      })
    }
    
  },
  todetail(e){
    var id = e.currentTarget.dataset.id;
    var title = e.currentTarget.dataset.title
    wx.navigateTo({
      url: '/hyb_yl/twosubpages/pages/details/details?id='+id+'&title='+title,
    })
  },
  getvalus(e){
    this.setData({
      keyword:e.detail.value
    })
  },
  searchs:function(){
    var that = this;
    that.setData({
      list:[],
      page:0,
      
    })
    that.getHot(that.data.keyword);
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this;
    that.getHot('');
  },
  getHot:function(keyword){
    var that = this;
    app.util.request({
      'url':"entry/wxapp/answer.hot_tank",
      data:{
        keyword:keyword,
        page:that.data.page,
        pagesize:that.data.pagesize
      },
      success:function(res){
        var page = that.data.page + 1;
        that.setData({
          list: that.data.list.concat(res.data),
          page: page,
          isLoading: !1
        });
      }
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
    var that = this;
    var keyword = that.data.keyword;
    that.getHot(keyword);
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})